import Vue from 'vue/dist/vue.js';
import {nav} from './kfm_js.js';
import 'style-loader!css-loader!../css/kfm_reset_css.css';
import 'style-loader!css-loader!../css/kfm.css';
import 'style-loader!css-loader!../css/scrollCss.css';
import scroll_cntrl_dwn from '../img/scroll/scroll_cntrl_dwn.png' ;
import scroll_cntrl_up from '../img/scroll/scroll_cntrl_up.png' ;
import scroll_gutter_btm from '../img/scroll/scroll_gutter_btm.png' ;
import scroll_gutter_btm_horizontal from '../img/scroll/scroll_gutter_btm-horizontal.png' ;
import scroll_gutter_mid from '../img/scroll/scroll_gutter_mid.png' ;
import scroll_gutter_mid_horizontal from '../img/scroll/scroll_gutter_mid-horizontal.png' ;
import scroll_gutter_top from '../img/scroll/scroll_gutter_top.png' ;
import scroll_gutter_top_horizontal from '../img/scroll/scroll_gutter_top-horizontal.png' ;
import scroll_thumb from '../img/scroll/scroll_thumb.png' ;
import scroll_thumb_horizontal from '../img/scroll/scroll_thumb-horizontal.png' ;
import source_code from "./QianDuanYuanMa/source_code.js";
import homepage from "./homepage/homepage.js";
import VueRouter from "vue-router";
import record_event from "./QianDuanJiShi/recordEvent.js";
Vue.use(VueRouter);

function run() {
    let r = new Vue(nav);
}
window.onload = function () {
    run();
    routerConfig.router = router();
    initRouter();
};

if (module.hot) {
    module.hot.accept('./print.js', function() {
        console.log('Accepting the updated printMe module!');
        printMe();
    })
}

/*路由器*/
export let routerConfig = {
    router:null,
    customRoutes:null
};

let initRouter = function () {
    /*只有在内容区域没有内容时才载入首页*/
    /*其意义是为了在其他页面刷新时,不会跳转到homepage*/
        if(routerConfig.router.$router.currentRoute.path==='/'){
            routerConfig.router.$router.push('/homepage');
    }
};

let router = function () {
    routerConfig.customRoutes = [
        { path: '/homepage', component: homepage.root },
        { path: '/source_code', component: source_code.root },
        { path: '/record_event', component: record_event.root }
    ];
    const router = new VueRouter({
        routes:routerConfig.customRoutes
    });

    return new Vue({router:router}).$mount('#router_view');
};
/*路由器结束*/









